home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12309 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: ccshst05.cs.uoguelph.ca!ccshst01!thay
  2. From: thay@uoguelph.ca (Toby K Hay)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: need random-# generator source (please!)
  5. Date: 30 Mar 1996 14:52:50 GMT
  6. Organization: University of Guelph
  7. Message-ID: <4jjhs2$d5a@ccshst05.cs.uoguelph.ca>
  8. References: <315cee22.18443869@news>
  9. NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Joseph Cheek (josephc@intele.net) wrote:
  13. : I need source to a random-number generator that will produce severely different
  14. : numbers when called several times in quick succession.  Please help -- where
  15. : can I find this?  TIA
  16.  
  17. If rand() isn't good enough you could look for r250.zip on the net.  I 
  18. got it by FTP from simtel/msdos/c at oak.oakland.edu.  But do you really 
  19. need it?  I'm quite sure that the time between calls to rand() makes no 
  20. difference to the sequence of pseudo-random numbers it returns.  Now, if 
  21. you made the mistake of calling srand() more than once and using a time 
  22. argument then two calls in quick succession will cause repeated random 
  23. numbers because the time seed will have been the same.  One call to 
  24. srand() should be enough in any program.
  25. Toby Hay    thay@uoguelph.ca
  26.